<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>防抖函数练习</title>
    <style>
        #container {
            width: 100%;
            height: 200px;
            line-height: 200px;
            text-align: center;
            color: #ffffff;
            background-color: #444444;
            font-size: 50px;
        }
    </style>
</head>

<body>
    <div id="container"></div>
    <script src="https://cdn.bootcss.com/underscore.js/1.9.1/underscore.js"></script>
    <script>
        var count = 0;
        // 演示事件是如何频繁发生的
        var container = document.querySelector('#container');
        // querySelector() 方法返回文档中匹配指定 CSS 选择器的一个元素。

        function doSomeThing() {
            container.innerHTML = count++;
        }

        // 高阶函数
        container.onmousemove = _.debounce(doSomeThing, 300);
    </script>
</body>

</html>